#include <bits/stdc++.h>
using namespace std;
bool check(string& s) {
  bool rk, bk, gk;
  rk = bk = gk = 0;
  for (auto c : s) {
    switch (c) {
      case 'r':
        rk = 1;
        break;
      case 'b':
        bk = 1;
        break;
      case 'g':
        gk = 1;
        break;
      case 'R':
        if (rk)
          break;
        else
          return 0;
      case 'B':
        if (bk)
          break;
        else
          return 0;
      case 'G':
        if (gk)
          break;
        else
          return 0;
    }
  }
  return true;
}
int main() {
  int tc;
  cin >> tc;
  while (tc--) {
    string s;
    cin >> s;
    cout << (check(s) ? "YES\n" : "NO\n");
  }
}
